<template>
	<view class="list-container">
		<view class="campus-student" v-for="(item,index) in list" :key="index" @click="goItem(item)">
			<image src="../../static/imgs/campus/stydent-icon.png" class="campus-student_icon"></image>
			<view style="width: 100%;">
				<view class="campus-student_name text_black">
					{{item.student_name}}
				</view>
				<view class="campus-student_msg text_opblack">
					<text>{{item.school_name}}</text>
					<text>{{item.class_name}}</text>
					<text>{{item.gender=='1'?'男':'女'}}</text>
				</view>
			</view>
			<image src="../../static/imgs/mine/right.png" class="campus-student_right"></image>
		</view>
		<view class="student-tips text_opblack">
			恭喜您已与学校成功绑定，您手机号下有多名学生绑定，请选择 一名学生进入校园体能（可以切换不同学生进入）
		</view>
	</view>
</template>

<script>
	import {getStudentStudent} from "../../static/js/api/plan.js"
	export default{
		data(){
			return{
				school:1,
				list:[
					{
						name:"王同学",
						tips:"限时免费报名参赛",
					},{
						name:"王同学",
						tips:"限时免费报名参赛",
					}
				], 
			}
		},
		onLoad(option) {
			this.school = option.school
			this.getData()
		},
		methods:{
			getData(){
				let _this = this
				getStudentStudent().then(res=>{
					console.log(res.students)
					this.list = res.students
				})
			},
			goItem(item){
				item.is_bind_school = this.school
				uni.navigateTo({
					url:"/pages/campus/index?studentInfo="+JSON.stringify(item)
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	@import url("./index.scss");
	.list-container{
		padding-bottom: constant(safe-area-inset-bottom);
		padding-bottom: env(safe-area-inset-bottom);
	}
	.text_opblack{
		color: $uni-text-color-opblack;
	}
	.text_black{
		color: $uni-text-color-black;
	}
	.campus-student{
		margin-bottom: 10rpx;
		margin-top: 0!important;
	}
</style>